@extends('adminDialog')
@section('content')
    <form action="{{url('admin/financial/editfina/'.$item->id)}}" method="POST" class="J_ajaxForm">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div class="pop_cont pop_table" style="overflow-y: scroll;height: 500px;">
            <table width="100%">
                <tbody>
                <tr>
                    <th>
                        <label for="title">产品类型</label>
                    </th>
                    <td>
                        <select name="fproductTypeId">
                            <option value="">--请选择--</option>
                            @foreach($types as $key=>$val)
                                <option value="{{$val->id}}" @if($val->id==$item->fproductTypeId)selected="selected"@endif>{{$val->name}}</option>
                            @endforeach
                        </select>
                        {{--<input type="text" name="fproductTypeId" id="" class="input length_6"  value="{{$item->fproductTypeId}}"/>--}}
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">产品代码</label>
                    </th>
                    <td>
                        <input type="text" name="productNo" id="" class="input length_6"  value="{{$item->productNo}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">金额</label>
                    </th>
                    <td>
                        <input type="text" name="price" id="" class="input length_6"  value="{{$item->price}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">投标价格</label>
                    </th>
                    <td>
                        <input type="text" name="bidpr" id="" class="input length_6"  value="{{$item->bidpr}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">产品标题</label>
                    </th>
                    <td>
                        <input type="text" name="title" id="" class="input length_6"  value="{{$item->title}}"/>
                    </td>
                </tr>

                <tr>
                    <th>
                        <label for="title">新手标</label>
                    </th>
                    <td>
                        <select name="novice">
                            <option value="1" @if (1==$item->novice)selected="selected" @endif>是</option>
                            <option value="0" @if (0==$item->novice)selected="selected" @endif >否</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">手续费</label>
                    </th>
                    <td>
                        <input type="text" name="poundage" id="" class="input length_6"  value="{{$item->poundage}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">积分</label>
                    </th>
                    <td>
                        <input type="text" name="fbonus" id="" class="input length_6"  value="{{$item->fbonus}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">限购</label>
                    </th>
                    <td>
                        <input type="text" name="limited" id="" class="input length_6"  value="{{$item->limited}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">总金额(元)</label>
                    </th>
                    <td>
                        <input type="text" name="amount" id="" class="input length_6"  value="{{$item->amount}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">还款方式</label>
                    </th>
                    <td>
                        <input type="text" name="payment" id="" class="input length_6"  value="{{$item->payment}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">计息方式</label>
                    </th>
                    <td>
                        <input type="text" name="interest" id="" class="input length_6"  value="{{$item->interest}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">期数（第几期）</label>
                    </th>
                    <td>
                        <input type="text" name="batch" id="" class="input length_6"  value="{{$item->batch}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">项目周期（月）</label>
                    </th>
                    <td>
                        <input type="text" name="period" id="" class="input length_6"  value="{{$item->period}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">年华率</label>
                    </th>
                    <td>
                        <input type="text" name="annualRate" id="" class="input length_6"  value="{{$item->annualRate}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">项目信息</label>
                    </th>
                    <td>
                       <textarea type="text" name="projectinfor"  style="width: 350px; height: 150px;" value=""    class="input length_6" >{{$item->projectinfor}}</textarea>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">借款人/借款企业</label>
                    </th>
                    <td>
                        <script id="container" name="borrower" type="text/plain">
                            {!! $item->borrower !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">出借人</label>
                    </th>
                    <td>
                        <script id="container1" name="lender" type="text/plain">
                            {!! $item->lender !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">抵押物</label>
                    </th>
                    <td>
                        <textarea type="text" name="pawn"  style="width: 350px; height: 150px;" value=""    class="input length_6" >{{$item->pawn}}</textarea>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">抵押物图片<span class="red">*</span></label>
                    </th>
                    <td class="uploadpawnimg">
                        @foreach($item->pawnimg as $key=>$images)
                            <span>
                                <img style="width:118px; height: 74px;" title="抵押物图片" src="{{$images}}"><input type="hidden" name="pawnimg[]" value="{{$images}}">
                                <a href="javascript:void(0);">X</a>
                            </span>
                        @endforeach
                        <a href="javascript:;" id="pickfile" class="pickfile" title="选择上传文件">
                            <img src=""  style="width:118px; height: 74px;" onerror="this.src='{{url("images/defaltPic.jpg")}}'"/>
                        </a>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">保证措施</label>
                    </th>
                    <td>
                        <script id="container2" name="measure" type="text/plain">
                            {!! $item->measure !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">还款来源</label>
                    </th>
                    <td>
                        <script id="container3" name="source" type="text/plain">
                            {!! $item->source !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">风控审核</label>
                    </th>
                    <td>
                        <script id="container4" name="auditing" type="text/plain">
                            {!! $item->auditing !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">监管保障</label>
                    </th>
                    <td>
                        <script id="container5" name="guarantee" type="text/plain">
                            {!! $item->guarantee !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">法律保障</label>
                    </th>
                    <td>
                        <script id="container6" name="law" type="text/plain">
                            {!! $item->law !!}
                        </script>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">相关信息（图片）<span class="red">*</span></label>
                    </th>
                    <td class="uploadmessageimg">
                        @foreach($item->messageimg as $key=>$images)
                            <span>
                                <img style="width:118px; height: 74px;" title="相关信息图片" src="{{$images}}"><input type="hidden" name="messageimg[]" value="{{$images}}">
                                <a href="javascript:void(0);">X</a>
                            </span>
                        @endforeach
                        <a href="javascript:;" id="pickfiless" class="pickfiless" title="选择上传文件">
                            <img src=""  style="width:118px; height: 74px;" onerror="this.src='{{url("images/defaltPic.jpg")}}'"/>
                        </a>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">活动开始</label>
                    </th>
                    <td>
                        <input type="date" name="start_at" id="" class="input length_6"  value="{{$item->start_at}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">活动结束</label>
                    </th>
                    <td>
                        <input type="date" name="end_at" id="" class="input length_6"  value="{{$item->end_at}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">还款日期</label>
                    </th>
                    <td>
                        <input type="date" name="pay_at" id="" class="input length_6"  value="{{$item->pay_at}}"/>
                    </td>
                </tr>
                <tr>
                    <th>
                        <label for="title">二维码:<span class="red">*</span></label>
                    </th>
                    <td class="uploadimg" >
                        @foreach($item->images as $key=>$images)
                            <span>
                                <img title="二维码" src="{{$images}}">
                                <input type="hidden" name="images[]" value="{{$images}}">
                                <a href="javascript:void(0);">X</a>
                            </span>
                        @endforeach
                        <a href="javascript:;" id="pickfiles" class="pickfiles" title="选择上传文件">
                            <img src="" onerror="this.src='{{url("images/defaltPic.jpg")}}'"/>
                        </a>
                    </td>
                </tr>
                {{--<tr>--}}
                {{--<th>--}}
                {{--<label for="title">礼包说明</label>--}}
                {{--</th>--}}
                {{--<td>--}}
                {{--<script id="container" name="gift" type="text/plain">--}}
                {{--{{$item->gift}}--}}
                {{--</script>--}}
                {{--</td>--}}
                {{--</tr>--}}
                {{--<tr>--}}
                {{--<th>--}}
                {{--<label for="title">特别说明:</label>--}}
                {{--</th>--}}
                {{--<td>--}}
                {{--<script id="container1" name="explain" type="text/plain">--}}
                {{--{{$item->explain}}--}}
                {{--</script>--}}
                {{--</td>--}}
                {{--</tr>--}}
                </tbody>
            </table>
        </div>

        <div class="pop_bottom cc">
            <button type="reset" class="btn fr" id="J_dialog_close">取消</button>
            <button type="submit" class="btn btn_submit J_ajax_submit_btn fr mr10" id="J_dialog_close">提交</button>
        </div>
    </form>
@stop

@section('style')
    <style type="text/css">
        .body_none {
            width: 720px;
        }
    </style>
@stop

@section('js')
    @parent
    @include('UEditor::head')
    <script src="{{ asset('js/plupload/plupload.full.min.js') }}"></script>
    <script>
        var ue = UE.getEditor('container', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });
        var ue1 = UE.getEditor('container1', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });
        var ue2 = UE.getEditor('container2', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });

        var ue4 = UE.getEditor('container4', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });
        var ue3 = UE.getEditor('container3', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });
        var ue5 = UE.getEditor('container5', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });
        var ue6 = UE.getEditor('container6', {
            initialFrameWidth: 560, initialFrameHeight: 260, autoHeightEnabled: false, toolbars: [
                ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
                ['link', 'simpleupload', 'insertimage','fontsize']
            ]
        });
        ue.ready(function () {
            ue.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
        ue1.ready(function () {
            ue1.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
        ue2.ready(function () {
            ue2.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
        ue3.ready(function () {
            ue3.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
        ue4.ready(function () {
            ue4.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
        ue5.ready(function () {
            ue5.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
        ue6.ready(function () {
            ue6.execCommand('serverparam', '_token', "{{ csrf_token() }}");//此处为支持laravel5 csrf ,根据实际情况修改,目的就是设置 _token 值.
        });
    </script>
    <script>
        $(function () {
            var uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'pickfiles', // you can pass in id...
                //container: document.getElementById('container'), // ... or DOM Element itself
                url: "{{ url('upimg') }}",
                filters: {
                    max_file_size: '5mb',
                    mime_types: [
                        {title: "Image files", extensions: "jpg,gif,png"}
                    ]
                },
                multi_selection: false,
                file_data_name: 'file',
                multipart_params: {'_token': '{{ csrf_token() }}', 'dir': 'financial'},
                // Flash settings
                flash_swf_url: '{{ asset("js/plupload/Moxie.swf") }}',
                // Silverlight settings
                silverlight_xap_url: '{{ asset('js/plupload/Moxie.xap') }}',

                init: {
                    PostInit: function () {
                        return false;
                    },
                    FilesAdded: function (up, file) {
                        $('.up-pic img').attr('src', '{{ asset('images/loading.gif') }}');
                        uploader.start();
                    },
                    Error: function (up, err) {
                        tips(err.message);
                    },
                    BeforeUpload: function(uploader,file){
                        if($(".uploadimg span img").length > 1){
                            alert("最多只能上传2张商品图片");
                            uploader.stop();
                            return;
                        }
                    },
                    FileUploaded: function (up, file, responseObj) {
                        var response = $.parseJSON(responseObj.response);
                        if (response.state == 'success') {
                            var　imgString = '<span><img title="商品图片" src="' + response.src + '"/><input type="hidden" name="images[]" value="' + response.src + '"/><a href="javascript:void(0);">X</a></span>';
                            $(".uploadimg").prepend(imgString);

                        } else {
                            tips(response.message);
                        }
                    }
                }
            });
            uploader.init();

            $(".uploadimg").on("click", "span a", function(){
                $(this).parent().remove();
            });

        });

    </script>
    <script>
        $(function () {
            var uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'pickfiless', // you can pass in id...
                //container: document.getElementById('container'), // ... or DOM Element itself
                url: "{{ url('upimg') }}",
                filters: {
                    max_file_size: '5mb',
                    mime_types: [
                        {title: "Image files", extensions: "jpg,gif,png"}
                    ]
                },
                multi_selection: false,
                file_data_name: 'file',
                multipart_params: {'_token': '{{ csrf_token() }}', 'dir': 'financial'},
                // Flash settings
                flash_swf_url: '{{ asset("js/plupload/Moxie.swf") }}',
                // Silverlight settings
                silverlight_xap_url: '{{ asset('js/plupload/Moxie.xap') }}',

                init: {
                    PostInit: function () {
                        return false;
                    },
                    FilesAdded: function (up, file) {
                        $('.up-pic img').attr('src', '{{ asset('images/loading.gif') }}');
                        uploader.start();
                    },
                    Error: function (up, err) {
                        tips(err.message);
                    },
//                    BeforeUpload: function(uploader,file){
//                        if($(".uploadmessageimg span img").length > 1){
//                            alert("最多只能上传2张商品图片");
//                            uploader.stop();
//                            return;
//                        }
//                    },
                    FileUploaded: function (up, file, responseObj) {
                        var response = $.parseJSON(responseObj.response);
                        if (response.state == 'success') {
                            var　imgString = '<span><img title="相关信息图片"  style="width:118px; height: 74px;"  src="' + response.src + '"/><input type="hidden" name="messageimg[]" value="' + response.src + '"/><a href="javascript:void(0);">X</a></span>';
                            $(".uploadmessageimg").prepend(imgString);

                        } else {
                            tips(response.message);
                        }
                    }
                }
            });
            uploader.init();

            $(".uploadmessageimg").on("click", "span a", function(){
                $(this).parent().remove();
            });

        });

    </script>
    <script>
        $(function () {
            var uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'pickfile', // you can pass in id...
                //container: document.getElementById('container'), // ... or DOM Element itself
                url: "{{ url('upimg') }}",
                filters: {
                    max_file_size: '15mb',
                    mime_types: [
                        {title: "Image files", extensions: "jpg,gif,png"}
                    ]
                },
                multi_selection: false,
                file_data_name: 'file',
                multipart_params: {'_token': '{{ csrf_token() }}', 'dir': 'financial'},
                // Flash settings
                flash_swf_url: '{{ asset("js/plupload/Moxie.swf") }}',
                // Silverlight settings
                silverlight_xap_url: '{{ asset('js/plupload/Moxie.xap') }}',

                init: {
                    PostInit: function () {
                        return false;
                    },
                    FilesAdded: function (up, file) {
                        $('.up-pic img').attr('src', '{{ asset('images/loading.gif') }}');
                        uploader.start();
                    },
                    Error: function (up, err) {
                        tips(err.message);
                    },
//                    BeforeUpload: function(uploader,file){
//                        if($(".uploadpawnimg span img").length > 1){
//                            alert("最多只能上传2张商品图片");
//                            uploader.stop();
//                            return;
//                        }
//                    },
                    FileUploaded: function (up, file, responseObj) {
                        var response = $.parseJSON(responseObj.response);
                        if (response.state == 'success') {
                            var　imgString = '<span><img title="抵押物图片" style="width:118px; height: 74px;"  src="' + response.src + '"/><input type="hidden" name="pawnimg[]" value="' + response.src + '"/><a href="javascript:void(0);">X</a></span>';
                            $(".uploadpawnimg").prepend(imgString);

                        } else {
                            tips(response.message);
                        }
                    }
                }
            });
            uploader.init();

            $(".uploadpawnimg").on("click", "span a", function(){
                $(this).parent().remove();
            });

        });

    </script>
@stop
